<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>endprotoent</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
endprotoent, getprotobynumber, getprotobyname, getprotoent, setprotoent - network protocol database functions
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="netdb.h.html">netdb.h</a>&gt;

void endprotoent(void);

struct protoent *getprotobyname(const char *<I>name</I>);

struct protoent *getprotobynumber(int <I>proto</I>);

struct protoent *getprotoent(void);

void setprotoent(int <I>stayopen</I>);
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
The
<i>getprotobyname()</i>,
<i>getprotobynumber()</i>
and
<i>getprotoent()</i>,
functions each return a pointer to a <B>protoent</B> structure, the members of
which contain the fields of an entry in the network protocol database.
<p>
The
<i>getprotoent()</i>
function reads the next entry of the database, opening a connection to the
database if necessary.
<p>
The
<i>getprotobyname()</i>
function searches the database from the beginning and finds the first entry
for which the protocol name specified by <I>name</I> matches the <B>p_name</B>
member, opening a connection to the database if necessary.
<p>
The
<i>getprotobynumber()</i>
function searches the database from the beginning and finds the first entry
for which the protocol number specified by <I>number</I> matches the
<B>p_proto</B> member, opening a connection to the database if necessary.
<p>
The
<i>setprotoent()</i>
function opens a connection to the database, and sets the next entry to the
first entry.  If the <I>stayopen</I> argument is non-zero, the connection to
the network protocol database will not be closed after each call to
<i>getprotoent()</i>
(either directly, or indirectly through one of the other
<i>getproto*()</i>
functions).
<p>
The
<i>endprotoent()</i>
function closes the connection to the database.
</blockquote><h4>RETURN VALUES</h4><blockquote>
On successful completion,
<i>getprotobyname()</i>,
<i>getprotobynumber()</i>
and
<i>getprotoent()</i>
functions return a pointer to a <B>protoent</B> structure if the requested
entry was found, and a null pointer if the end of the database was reached or
the requested entry was not found.  Otherwise, a null pointer is returned.
</blockquote><h4>ERRORS</h4><blockquote>
No errors are defined.
</blockquote><h4>APPLICATION USAGE</h4><blockquote>
The
<i>getprotobyname()</i>,
<i>getprotobynumber()</i>
and
<i>getprotoent()</i>
functions may return pointers to static data, which may be overwritten by
subsequent calls to any of these functions.
<p>
These functions are generally used with the Internet address family.
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="netdb.h.html">&lt;netdb.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
